#include<string>
using namespace std;

class Solution {
public:
    string strWithout3a3b(int A, int B) {
        string res = "";
        while (A > 0 || B > 0) {
            bool writeA = false;
            int len = res.size();
            if (len >= 2 && res[len - 2] == res[len - 1]) {
                if (res[len - 1] == 'b')
                    writeA = true;
            }
            else {
                if (A > B)
                    writeA = true;
            }
            if (writeA) {
                res += "a";
                --A;
            }
            else {
                res += "b";
                --B;
            }
        }
        return res;
    }
};